package String;

public class Test3 {
    public static void main(String[] args) {
        //一、字符串替换
        //1.replace
//        String s1 = "林同学，你真帅，林同学，你真聪明";
//        String s2 = s1.replace("林","莫");
//        System.out.println(s2);

        //二。字符串拆分
        //1.split
//        String s3 = "c++,Java,Python,C#";
//        String[] languages = s3.split(",");
//        for (String language:languages){
//            System.out.println(language);
//        }

        //三、字符串取字串
        //1.使用substring
//        String s4 = "abcdefg";
//        System.out.println(s4.substring(2));
//        System.out.println(s4.substring(2,6));

        //四、去除左右两边的空格
        //1.trim
        String s5 = "     \f     \t   hello world               \t";
        String s6 = s5.trim();
        System.out.println(s6);

    }
}
